function vmd_images(fbase, fnum)
%
%   vmd_images(fbase, fnum)
%
%   Reads file with density distribution and file with x-velocity.
%   Creates bunch of images.
%
%   Input:
%        fbase   base of file number (runname)
%        fnum    file number
%
%   Domain information and colormap limits are edited in the file.
%%

%---------------------------------------------------------

% system size

jx=96; jy=96; jz=32; jv=256; jdir=8;


% physics paramters

%u0=1.24; vPhase=3.53235; uAngle=0;
u0=1; vPhase=3.45; uAngle=1/8.;


% colormap bounds

maxDn = 0.05;  
maxUz = 0.075; maxUx = 0.004; maxUy = 0.004;
maxUx=2.e-6;


%-- backround velocities --------------------------------

  theta = 2*pi*(0:jdir-1)/jdir + pi*uAngle;
  ux0 = u0 * cos(theta);
  uy0 = u0 * sin(theta);
  v0  = -vPhase;


%-- density ---------------------------------------------

  fn = num2str(fnum,'%04d');

  fname = [fbase, '.dn.', fn]

  fid = fopen(fname, 'rb');
  f = fread(fid, jx*jy*jz, 'double');
  fclose(fid);

  f = reshape(f, jz,jy,jx);

  img_slices(f, fname, -maxDn, maxDn)

  max0= max(max(max( abs(f(:,:,jx/2+1))   )))
  max1= max(max(max( abs(f(:,:,jx/4+1))   )))
  max1/max0

return

%-- Uz, direction 1  -------------------------------------

  fn = num2str(fnum,'%04d');

  fname = [fbase, '.uz.', fn, '.00'];

  fid = fopen(fname, 'rb');
  f = fread(fid, jx*jy*jz, 'double');
  fclose(fid);

  f = reshape(f, jz,jy,jx) - v0;

  img_slices(f, fname, -maxUz, maxUz)


%-- Ux, direction 1  -------------------------------------

  fn = num2str(fnum,'%04d');

  fname = [fbase, '.ux.', fn, '.00'];

  fid = fopen(fname, 'rb');
  f = fread(fid, jx*jy*jz, 'double');
  fclose(fid);

  f = reshape(f, jz,jy,jx);

  ux = f(:,:,:,1)- ux0(1);
  img_slices(ux, fname, -maxUx, maxUx)


  %img_slices(ux, fname, -maxUx, maxUx)


end

%---------------------------------------------------------
